import javax.swing.*;
import java.awt.*;

public class GameFrame extends JFrame {
    //定义窗口大小
    final int frameSize = 500;

    //launch 启动程序
    public void launch(){
        //设置窗口标题
        this.setTitle("贪吃蛇");
        //设置窗口大小
        this.setSize(frameSize,frameSize);
        //设置窗口相对位置 居中
        this.setLocationRelativeTo(null);
        //是否可见
        this.setVisible(true);
        //设置窗口关闭操作
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    //设置颜色
    public void paint(Graphics graphics){
        graphics.setColor(Color.lightGray);
        graphics.fillRect(0,0,frameSize,frameSize);
    }

    public static void main(String[] args) {
        GameFrame gameFrame = new GameFrame();
        gameFrame.launch();
    }
}
